package com.hd.trans.share;

import android.os.Handler;

public class ThreadPoolWrapper {

    private ThreadPoolWrapper() {
    }

    /**
     * io线程执行
     *
     * @param runnable
     */
    public static void excuseThread(Runnable runnable) {
        HdArchTaskExecutor.getInstance().executeOnDiskIO(runnable);
    }

    private static final Handler mHandler = new Handler();

    /**
     * UI线程执行
     *
     * @param runnable
     */
    public static void runOnUiThread(Runnable runnable) {
        HdArchTaskExecutor.getInstance().executeOnMainThread(runnable);
    }

    /**
     * UI线程执行
     *
     * @param runnable
     * @param delayMillis 延迟多少毫秒
     */
    public static void runOnUiThread(Runnable runnable, long delayMillis) {
        mHandler.postDelayed(() -> runOnUiThread(runnable), delayMillis);
    }

}
